<?php
/*
	Copyright 2006, 2007, 2008, 2009, 2010 Bastiaan Grutters
    
    This file is part of Ages of Strife website.

    Ages of Strife website is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Ages of Strife website is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Ages of Strife website.  If not, see <http://www.gnu.org/licenses/>.
 */
include( '../global/initialize.php' );
global $dal;

$query = "SELECT auto_refresh " .
		"FROM users " .
		"WHERE user_id = " . $_SESSION[ 'user_id' ];
$result = mysql_query( $query ) or die( "Query failed : " . mysql_error() );
$row = mysql_fetch_array($result, MYSQL_ASSOC);
aos_header( 'Overview', ( $row[ 'auto_refresh' ] == 1 ) );

$army_total = get_total_deployed_military();

$query = "SELECT * FROM ruler WHERE ruler_id = " . $_SESSION[ 'ruler_id' ];
$result = mysql_query( $query ) or die( "Query failed : " . mysql_error() );
$row = mysql_fetch_array($result, MYSQL_ASSOC);

if( isset( $_SESSION[ 'user_just_signed_up' ] ) && $_SESSION[ 'user_just_signed_up' ] == 1 ) {
?>
				<div class="blok">
					<strong><?php transprint( 'Welcome to Ages of Strife' ); ?></strong><br />
					<?php transprint( 'This page shows you some information of your empire the larger you grow the more information will be shown here.' ); ?><br />
					<?php transprint( 'Note: This is a turn based game there is a turn update every hour, so some actions might take several hours before they are complete.' ); ?><br />
					<br />
					<?php transprint( 'If you are not sure how to get started check out the highlighted tasks link below.' ); ?><br />
					<br />
					<?php transprint( 'Good luck!' ); ?><br />
				</div>
				<br />
<?php
	unset( $_SESSION[ 'user_just_signed_up' ] );
}

if( isset( $_SESSION[ 'multiple_ip_usage' ] ) ) {
	if( isset( $_SESSION[ 'multiple_ip_usage_counter' ] ) ) {
		$_SESSION[ 'multiple_ip_usage_counter' ] ++;
		if( $_SESSION[ 'multiple_ip_usage_counter' ] >= 3 ) {
			unset( $_SESSION[ 'multiple_ip_usage_counter' ] );
			unset( $_SESSION[ 'multiple_ip_usage' ] );
		}
	}
	else {
		$_SESSION[ 'multiple_ip_usage_counter' ] = 1;
	}
?>
				<div class="blok">
					<strong><?php transprint( 'Multiple users from the same IP' ); ?></strong><br />
					<?php transprint( 'There are multiple users accessing the game from your public IP address.' ); ?><br />
					<?php transprint( 'Please keep in mind that using multiple accounts is against the game rules,' ); ?><br />
					<?php transprint( 'you are however free to play the game with multiple people from one public IP address.' ); ?><br />
					<br />
					<?php transprint( 'For more information about playing with multiple people from one public IP address, click <a href="../aosmanual/multiple_ip_usage.php">here</a>.' ); ?><br />
				</div>
				<br />
<?php	
}
?>
				<table id="overview">
					<tr>
						<td><?php transprint( 'Name' ); ?>:</td>
						<td align="right"><a href="ruler.php?name=<?php print( $row[ 'name' ] ); ?>"><strong><?php print( $row[ 'name' ] ); ?></strong></a></td>
						<td class="middle"></td>
<?php
$query3 = "SELECT name, type_name " .
		"FROM faction " .
		"JOIN faction_types ON faction.faction_type_id = faction_types.faction_type_id " .
		"JOIN faction_member ON faction.faction_id = faction_member.faction_id " .
		"WHERE ruler_id = " . $_SESSION[ 'ruler_id' ] . " AND requested = 0 AND invited = 0";
$result3 = mysql_query( $query3 ) or die( "Query failed : " . mysql_error() );
$row3 = mysql_fetch_array( $result3, MYSQL_ASSOC );
if( isset( $row3[ 'type_name' ] ) ) {
	print( "<td>" . translate( $row3[ 'type_name' ] ) . ":</td><td align=\"right\"><a href=\"faction.php?name=" . $row3[ 'name' ] . "\">" . $row3[ 'name' ] . "</a></td></tr>\r\n" ); //<tr>
}
else {
	print( "<td></td><td></td></tr>\r\n" );
}
print( "<tr><td></td><td></td><td class=\"middle\"></td><td></td><td></td></tr>\r\n" );
print( "<tr><td><strong>" . translate ( "Economy" ) . "</strong></td><td>&nbsp;</td><td class=\"middle\">&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>\r\n" );
print( "<tr><td><a href=\"../aosmanual/concepts.php#tax\"\>" . translate ( "Tax level" ) . "</a>:</td><td align=\"right\"><form method=\"post\" action=\"change_tax.php\"><select name=\"taxes\">" );
$selected = "";
if( $row[ 'tax_level' ] == 1 ) {
	$selected = " selected=\"selected\"";
}
print( "<option value=\"1\"$selected>" . translate ( "Low" ) . "</option>" );
$selected = "";
if( $row[ 'tax_level' ] == 2 ) {
	$selected = " selected=\"selected\"";
}
print( "<option value=\"2\"$selected>" . translate ( "Normal" ) . "</option>" );
$selected = "";
if( $row[ 'tax_level' ] == 3 ) {
	$selected = " selected=\"selected\"";
}
print( "<option value=\"3\"$selected>" . translate ( "High" ) . "</option>" );
print( "</select> " .
		"<input type=\"hidden\" name=\"xsrfcheck\" value=\"" . sha1( $_SESSION[ 'user_id' ] . 'secretCodE' ) . "\" />" .
		"<input type=\"submit\" value=\"" . translate( 'change' ) . "\" /></form></td><td class=\"middle\"></td><td><small>(" . translate ( "Tax level affects miner efficiency" ) . ")</small></td><td></td></tr>" );

print "<tr><td>" . translate ( "Treasury" ) . ":</td><td align=\"right\"><strong id=\"gold\">" . number_format( $row[ 'gold' ] ) . "</strong> " . translate ( "gold" ) . "</td><td class=\"middle\"></td>\r\n"; //</tr>
print "<td>" . translate ( "Iron" ) . ":</td><td align=\"right\"><strong id=\"iron\">" . number_format( $row[ 'iron' ] ) . "</strong></td></tr>\r\n"; //<tr>

if( $row[ 'lastday_taxes' ] > 0 ) {
	print "<tr><td>" . translate ( "Yesterdays tax income" ) . ":</td><td align=\"right\"><strong id=\"gold\">+ " . number_format( $row[ 'lastday_taxes' ] ) . "</strong> " . translate ( "gold" ) . "</td><td class=\"middle\"></td>\r\n"; //</tr>
}
else {
	print "<tr><td></td><td></td><td class=\"middle\"></td>\r\n"; //</tr>
}
if( $row[ 'iron_income' ] > 0 ) {
	print "<td>" . translate ( "Yesterdays iron income" ) . ":</td><td align=\"right\"><strong id=\"iron\">+ " . number_format( $row[ 'iron_income' ] ) . "</strong></td></tr>\r\n"; //<tr>
}
else {
	print "<td></td><td></td></tr>\r\n"; //<tr>
}

if( $row[ 'officer_pay' ] > 0 ) {
	print "<tr><td>" . translate ( "Officers pay" ) . ":</td><td align=\"right\"><strong id=\"gold\">- " . number_format( $row[ 'officer_pay' ] ) . "</strong> " . translate ( "gold" ) . "</td><td class=\"middle\"></td>\r\n"; //</tr>
}
else {
	print "<tr><td></td><td></td><td class=\"middle\"></td>\r\n"; //</tr>
}
print "<td>" . translate ( "Coal" ) . ":</td><td align=\"right\"><strong id=\"coal\">" . number_format( $row[ 'coal' ] ) . "</strong></td></tr>\r\n"; //<tr>

$query2 = "SELECT gold_paid FROM faction_member WHERE ruler_id = " . $_SESSION[ 'ruler_id' ] . " AND invited = 0 AND requested = 0";
$result2 = mysql_query( $query2 ) or die( "Query failed : " . mysql_error() );
$row2 = mysql_fetch_array( $result2, MYSQL_ASSOC );
if( isset( $row2[ 'gold_paid' ] ) && $row2[ 'gold_paid' ] > 0 ) {
	print "<tr><td>" . translate ( "Faction contribution" ) . ":</td><td align=\"right\"><strong id=\"gold\">- " . number_format( $row2[ 'gold_paid' ] ) . "</strong> " . translate ( "gold" ) . "</td><td class=\"middle\"></td>\r\n"; //</tr>
}
else {
	print( "<tr><td></td><td></td><td class=\"middle\"></td>\r\n" );
}
//print "<tr><td></td><td></td></tr>\r\n";
if( $row[ 'coal_income' ] > 0 ) {
	print "<td>" . translate ( "Yesterdays coal income" ) . ":</td><td align=\"right\"><strong id=\"coal\">+ " . number_format( $row[ 'coal_income' ] ) . "</strong></td></tr>\r\n"; //<tr>
}
else {
	print "<td></td><td></td></tr>\r\n"; //<tr>
}

if( $row[ 'food_income' ] > 0 ) {
	$text = 'Excess food yesterday';
}
elseif( $row[ 'food_income' ] < 0 ) {
	$text = 'Food shortage yesterday';
}
else {
	$text = 'Food income';
}
?>
				<tr>
					<td><?php transprint( 'Food' ); ?>:</td>
					<td align="right"><strong class="food"><?php print( number_format( $row[ 'food' ] ) ); ?></strong></td>
					<td class="middle"></td>
					<td><?php transprint( $text ); ?>:</td>
					<td align="right"><strong class="food"><?php print( number_format( abs( $row[ 'food_income' ] ) ) ); ?></strong></td>
				</tr>
<?php
$statement = $dal->prepare( 'SELECT SUM(population) ' .
		'FROM village ' .
		'WHERE ruler_id = :ruler_id' );
$statement->bindParam( ':ruler_id', $_SESSION[ 'ruler_id' ], PDO::PARAM_INT );
$population = $dal->getValue( $statement );
// With negative food income we show how many days are left before we run out of food
$daysLeft = number_format( floor( $row[ 'food' ] / ( $population * 0.1 ) ) );
if( $daysLeft == 1 ) {
	$daysLeft .= ' ' . translate( 'day' );
}
else {
	$daysLeft .= ' ' . translate( 'days' );
}
if( $row[ 'food_income' ] < 0 ) {
	$daysLeftIncome = number_format( floor( $row[ 'food' ] / abs( $row[ 'food_income' ] ) ) );
	if( $daysLeftIncome == 1 ) {
		$daysLeftIncome .= ' ' . translate( 'day' );
	}
	else {
		$daysLeftIncome .= ' ' . translate( 'days' );
	}
}
else {
	$daysLeftIncome = translate( 'Forever' );
}
if( $row[ 'food_income' ] < 0 && $daysLeft == floor( $row[ 'food' ] / abs( $row[ 'food_income' ] ) ) ) {
	$showIncludingIncome = false;
}
else {
	$showIncludingIncome = true;
}
?>
				<tr>
					<td><?php transprint( 'Stockpiled food' ); ?>:</td>
					<td align="right"><?php print( $daysLeft ); ?></td>
					<td class="middle"></td>
					<td><?php print( $showIncludingIncome ? translate( 'Including food income' ) . ': ' : '' ); ?></td>
					<td align="right"><?php print( $showIncludingIncome ? $daysLeftIncome : '' ); ?></td>
				</tr>

<?php	
print( "<tr><td></td><td></td><td class=\"middle\"></td><td></td><td></td></tr>\r\n" );
if( $row[ 'year_gold' ] > 0 ) {
	print( "<tr><td>" . translate ( "Current year taxes" ) . ":</td><td align=\"right\"><strong id=\"gold\">" . number_format( $row[ 'year_gold' ] ) . "</strong></td><td class=\"middle\"></td><td>" . translate ( "Last years taxes" ) . ":</td>" );
	print( "<td align=\"right\"><strong id=\"gold\">" . number_format( $row[ 'last_year_gold' ] ) . "</strong></td></tr>\r\n" );
	print( "<tr><td>" . translate ( "Current year iron" ) . ":</td><td align=\"right\"><strong id=\"iron\">" . number_format( $row[ 'year_iron' ] ) . "</strong></td><td class=\"middle\"></td>" );
	print( "<td>" . translate ( "Last years iron" ) . ":</td><td align=\"right\"><strong id=\"iron\">" . number_format( $row[ 'last_year_iron' ] ) . "</strong></td></tr>\r\n" ); 
	print( "<tr><td>" . translate ( "Current year coal" ) . ":</td><td align=\"right\"><strong id=\"coal\">" . number_format( $row[ 'year_coal' ] ) . "</strong></td>" );
	print( "<td class=\"middle\"></td><td>" . translate ( "Last years coal" ) . ":</td><td align=\"right\"><strong id=\"coal\">" . number_format( $row[ 'last_year_coal' ] ) . "</strong></td></tr>\r\n" );
} 

if( $row[ 'last_year_score' ] > 0 && $row[ 'score' ] > 0 ) {
	$growth = round( ( $row[ 'score' ] / $row[ 'last_year_score' ] - 1 ) * 100, 2 ) . '%';
	print( "<tr><td>" . translate ( "Growth" ) . ":</td><td align=\"right\">$growth</td>" );
}
else {
	print( "<tr><td></td><td></td>" );
}
if( $row[ 'last_year_score' ] > 0 ) {
	print( "<td class=\"middle\"></td><td>" . translate ( "Last years growth" ) . ":</td><td align=\"right\">" . round( $row[ 'last_year_growth' ], 2 ) . "%</td></tr>\r\n" );
}
else {
	print( "<td class=\"middle\"></td><td></td><td></td></tr>\r\n" );
}


print( "<tr><td></td><td></td><td class=\"middle\"></td><td></td><td></td></tr>\r\n" );
print( "<tr><td><strong>" . translate ( "Military" ) . "</strong></td><td>&nbsp;</td><td class=\"middle\">&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>\r\n" );

//print "<tr><td>Total population:</td><td align=\"right\">" . number_format( $total_population ) . "</td></tr>\r\n";
$total_military = get_total_military();
$reserve_total = get_total_reserves_military();

if( $total_military > 100000 ) {
	$morale = get_morale_string( $row[ 'morale' ] );
	print( "<tr><td>" . translate ( "Size" ) . ":</td><td align=\"right\">" . number_format( $total_military ) . "</td>" .
			"<td class=\"middle\"></td>\r\n" );
	print( "<td><a href=\"../aosmanual/concepts.php#military morale\">" . translate ( "Morale" ) . "</a>:</td><td align=\"right\"><a href=\"../armies/morale.php\">$morale</a></td></tr>\r\n" );
}

if( $army_total > 0 ) {
	print "<tr><td>" . translate ( "Deployed soldiers" ) . ":</td><td align=\"right\">" . number_format( $army_total ) . "</td><td class=\"middle\"></td>\r\n";
}
else {
	if( $reserve_total == 0 ) {
		print( "<tr><td>" . translate ( "None" ) . "</td><td></td><td class=\"middle\"></td>\r\n" );
	}
	else {
		print( "<tr><td></td><td></td><td class=\"middle\"></td>\r\n" );
	}
}
if( $reserve_total > 0 ) {
	print "<td>" . translate ( "Total reserves" ) . ":</td><td align=\"right\"><strong class=\"recruits\">" . number_format( $reserve_total ) . "</strong></td></tr>\r\n";
}
else {
	print "<td></td><td></td></tr>\r\n";
}

$query2 = "SELECT SUM( scout ), SUM( infantry ), SUM( cavalry ), SUM( artillery ) FROM army WHERE ruler_id = " . $_SESSION[ 'ruler_id' ];
$result2 = mysql_query( $query2 ) or die( "Query failed : " . mysql_error() );
$row2 = mysql_fetch_array( $result2, MYSQL_ASSOC );

if( $row2[ 'SUM( scout )' ] > 0 ) {
	print( "<tr><td>" . translate ( "Deployed scouts" ) . ":</td><td align=\"right\"><strong class=\"scouts\">" . number_format( $row2[ 'SUM( scout )' ] ) . "</strong></td><td class=\"middle\"></td>\r\n" );
}
else {
	print( "<tr><td></td><td></td><td class=\"middle\"></td>\r\n" );
}

if( $row2[ 'SUM( infantry )' ] > 0 ) {
	print( "<td>" . translate ( "Deployed infantry" ) . ":</td><td align=\"right\"><strong class=\"infantry\">" . number_format( $row2[ 'SUM( infantry )' ] ) . "</strong></td></tr>\r\n" );
}
else {
	print( "<td></td><td></td></tr>\r\n" );
}

if( $row2[ 'SUM( cavalry )' ] > 0 ) {
	print( "<tr><td>" . translate ( "Deployed cavalry" ) . ":</td><td align=\"right\"><strong class=\"cavalry\">" . number_format( $row2[ 'SUM( cavalry )' ] ) . "</strong></td><td class=\"middle\"></td>\r\n" );
}
else {
	print( "<tr><td></td><td></td><td class=\"middle\"></td>\r\n" );
}

if( $row2[ 'SUM( artillery )' ] > 0 ) {
	print( "<td>" . translate ( "Deployed artillery" ) . ":</td><td align=\"right\"><strong class=\"artillery\">" . number_format( $row2[ 'SUM( artillery )' ] ) . "</strong></td></tr>\r\n" );
}
else {
	print( "<td></td><td></td></tr>\r\n" );
}

if( $row[ 'scouts' ] > 0 ) {
	print( "<tr><td>" . translate ( "Reserve scouts" ) . ":</td><td align=\"right\"><strong class=\"scouts\">" . number_format( $row[ 'scouts' ] ) . "</strong></td><td class=\"middle\"></td>\r\n" );
}
else {
	print( "<tr><td></td><td></td><td class=\"middle\"></td>\r\n" );
}

if( $row[ 'infantry' ] > 0 ) {
	print( "<td>" . translate ( "Reserve infantry" ) . ":</td><td align=\"right\"><strong class=\"infantry\">" . number_format( $row[ 'infantry' ] ) . "</strong></td></tr>\r\n" );
}
else {
	print( "<td></td><td></td></tr>\r\n" );
}

if( $row[ 'cavalry' ] > 0 ) {
	print( "<tr><td>" . translate ( "Reserve cavalry" ) . ":</td><td align=\"right\"><strong class=\"cavalry\">" . number_format( $row[ 'cavalry' ] ) . "</strong></td><td class=\"middle\"></td>\r\n" );
}
else {
	print( "<tr><td></td><td></td><td class=\"middle\"></td>\r\n" );
}

if( $row[ 'artillery' ] > 0 ) {
	print( "<td>" . translate ( "Reserve artillery" ) . ":</td><td align=\"right\"><strong class=\"artillery\">" . number_format( $row[ 'artillery' ] ) . "</strong></td></tr>\r\n" );
}
else {
	print( "<td></td><td></td></tr>\r\n" );
}

print "<tr><td></td><td></td><td class=\"middle\"></td><td></td><td></td></tr>\r\n";
print( "<tr><td><strong>" . translate ( "Score and rankings" ) . "</strong></td><td>&nbsp;</td><td class=\"middle\">&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>\r\n" );
print "<tr><td>" . translate( "Score" ) . ":</td><td align=\"right\">" . number_format( $row[ 'score' ] ) . "</td><td class=\"middle\"></td>\r\n"; //</tr>
if( $row[ 'experience' ] > 0 ) {
	print "<td>" . translate ( "Battle score" ) . ":</td><td align=\"right\">" . number_format( $row[ 'experience' ] ) . "</td></tr>\r\n";
}
else {
	print "<td></td><td></td></tr>\r\n";
}
$query2 = "SELECT count(*) FROM ruler WHERE score > " . $row[ 'score' ];
$result2 = mysql_query( $query2 ) or die( "Query failed : " . mysql_error() );
$row2 = mysql_fetch_array( $result2, MYSQL_ASSOC );
print "<tr><td>" . translate ( "Rank" ) . ":</td><td align=\"right\">" . number_format( $row2[ 'count(*)' ] + 1 ) . "</td><td class=\"middle\"></td>\r\n"; //</tr>
if( $row[ 'experience' ] > 0 ) {
	$query2 = "SELECT count(*) FROM ruler WHERE experience > " . $row[ 'experience' ];
	$result2 = mysql_query( $query2 ) or die( "Query failed : " . mysql_error() );
	$row2 = mysql_fetch_array( $result2, MYSQL_ASSOC );
	print "<td>" . translate ( "Battle rank" ) . ":</td><td align=\"right\">" . number_format( $row2[ 'count(*)' ] + 1 ) . "</td></tr>\r\n"; //<tr>
}
else {
	print "<td></td><td></td></tr>\r\n";
}
if( $row[ 'economy_points' ] > 0 ) {
	print( "<tr><td>" . translate ( "Economy points" ) . ":</td><td align=\"right\">" . number_format( $row[ 'economy_points' ] ) . "</td><td class=\"middle\"></td>" );
}
else {
	print( "<tr><td>&nbsp</td><td>&nbsp;</td><td class=\"middle\"></td>" );
}
if( $row[ 'warrior_points' ] > 0 ) {
	print( "<td>" . translate ( "War points" ) . ":</td><td align=\"right\">" . number_format( $row[ 'warrior_points' ] + 1 ) . "</td></tr>\r\n" );
}
else {
	print( "<td>&nbsp</td><td>&nbsp;</td></tr>" );
}

if( $row[ 'economy_points' ] > 0 ) {
	$query2 = "SELECT count(*) FROM ruler WHERE economy_points > " . $row[ 'economy_points' ];
	$result2 = mysql_query( $query2 ) or die( "Query failed : " . mysql_error() );
	$row2 = mysql_fetch_array( $result2, MYSQL_ASSOC );
	print( "<tr><td>" . translate ( "Economy rank" ) . ":</td><td align=\"right\">" . number_format( $row2[ 'count(*)' ] + 1 ) . "</td><td class=\"middle\"></td>" );
}
else {
	print( "<tr><td>&nbsp</td><td>&nbsp;</td><td class=\"middle\"></td>" );
}
if( $row[ 'warrior_points' ] > 0 ) {
	$query2 = "SELECT count(*) FROM ruler WHERE warrior_points > " . $row[ 'warrior_points' ];
	$result2 = mysql_query( $query2 ) or die( "Query failed : " . mysql_error() );
	$row2 = mysql_fetch_array( $result2, MYSQL_ASSOC );
	print( "<td>" . translate ( "War rank" ) . ":</td><td align=\"right\">" . number_format( $row2[ 'count(*)' ] + 1 ) . "</td></tr>\r\n" );
}
else {
	print( "<td>&nbsp</td><td>&nbsp;</td></tr>" );
}
$reputation = get_reputation_string( $row[ 'score' ], $row[ 'experience' ] );
$newBattlescore = $row[ 'experience' ] - $row[ 'experience_before' ];
?>
				<tr>
					<td><?php transprint( "Reputation" ); ?>:</td>
					<td align="right"><?php print( $reputation ); ?></td>
					<td class="middle">&nbsp;</td>
					<td><a href="../aosmanual/concepts.php#new battlescore"><?php transprint( "New battlescore" ); ?></a>:</td>
					<td align="right"><?php print( number_format( $newBattlescore ) ); ?></td>
				</tr>
<?php
$statement = $dal->prepare( 'SELECT `title` ' .
		'FROM ruler_task ' .
		'JOIN tasks ON tasks.task_id = ruler_task.task_id ' .
		'WHERE ruler_id = :ruler_id AND completed = 0' );
$statement->bindParam( ':ruler_id', $_SESSION[ 'ruler_id' ], PDO::PARAM_INT );
$task = $dal->getValue( $statement );
if( isset( $task ) ) {
	$currenTask = translate( $task );
}
else {
	$currenTask = translate( 'Awards and decorations' );
}

$statement = $dal->prepare( 'SELECT count(*) ' .
		'FROM ruler_task ' .
		'WHERE ruler_id = :ruler_id AND completed = 1' );
$statement->bindParam( ':ruler_id', $_SESSION[ 'ruler_id' ], PDO::PARAM_INT );
$completedTasks = $dal->getValue( $statement );

if( isset( $highlight5 ) && $highlight5 != '' ) {
	$strong = '<strong>';
	$end = '</strong>';
	$class = ' class="highlight"';
}
else {
	$strong = '';
	$end = '';
	$class = '';
}
?>
						<tr><td>&nbsp;</td><td>&nbsp;</td><td class="middle">&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
						<tr>
							<td><strong><?php transprint( 'Tasks' ); ?></strong></td><td></td><td class="middle"></td><td></td><td></td>
						</tr>
						<tr>
							<td><a title="View tasks" href="tasks.php"><?php transprint( 'Current task' ); ?></a>:</td>
							<td align="right"><a title="View tasks" href="tasks.php"<?php print( $class ); ?>><?php print( $strong ); ?><?php print( $currenTask ); ?><?php print( $end ); ?></a></td>
							<td class="middle"></td>
							<td><a title="View tasks" href="tasks.php"><?php transprint( 'Completed tasks' ); ?></a>:</td>
							<td align="right"><?php print( $completedTasks ); ?></td>
						</tr>
					</table>
					<br />
					<div id="overview-links" class="blok">
						<strong><?php transprint( 'Links' ); ?></strong><br />
						<a href="ruler_ranks.php"><?php transprint( 'Top 50 rulers in score' ); ?></a><br />
						<a href="economy_ranking.php"><?php transprint( 'Top 50 economy points' ); ?></a><br />
						<a href="war_ranking.php"><?php transprint( 'Top 50 war points' ); ?></a><br />
						<br />
						<a href="faction_ranks.php"><?php transprint( 'Top 25 factions' ); ?></a><br />
						<?php transprint( 'Top villages' ); ?>: <a href="top_villages.php?type=population"><?php transprint( 'Population' ); ?></a>, <a href="top_villages.php?type=food"><?php transprint( 'Food' ); ?></a>, <a href="top_villages.php?type=coal"><?php transprint( 'Coal' ); ?></a> <?php transprint( 'and' ); ?> <a href="top_villages.php?type=iron"><?php transprint( 'Iron' ); ?></a><br />
						<br />
						<a href="statistics.php"><?php transprint( 'Statistics' ); ?></a><br/>
<?php
global $language;
if( !translations_is_default_language( $language ) ) {
?>
						<a href="translate.php"><?php transprint( 'Translate' ); ?></a><br />
<?php
}
?>
						<a href="settings.php"><?php transprint( 'Account settings' ); ?></a><br/>
					</div>
<?php
aos_footer();
?>